import 'reflect-metadata'

const ClassDecoData = 'class-deco-data'
const MethodDecoData = 'method-deco-data'

function ClassDeco(): ClassDecorator {
	return target => {
		Reflect.defineMetadata(ClassDecoData, 'a', target)
	}
}

function MethodDeco(): MethodDecorator {
	return (target, key, descriptor) => {
		console.log(Reflect.getMetadata('design:paramtypes', target, key))
		console.log(Reflect.getMetadata('design:returntype', target, key))
		Reflect.defineMetadata(MethodDecoData, 'b', target, key)
	}
}

@ClassDeco()
class DefineClass {
	@MethodDeco()
	meth(p: string, q: string): string {
		return ''
	}
}

const i = new DefineClass()

console.log(Reflect.getMetadata(ClassDecoData, DefineClass))
console.log(Reflect.getMetadata(MethodDecoData, i, 'meth'))
console.log('ok')